﻿#region Usings

using System.Windows.Media.Imaging;
using SilverBox.Imaging;

#endregion

namespace SilverBox.Extensions
{
    public static class WriteableBitmapExtensions
    {
        public static string Serialize(this WriteableBitmap obj)
        {
            var tBitmap = new TransportableBitmap
                (obj.Pixels, obj.PixelHeight, obj.PixelWidth);
            var json = tBitmap
                .SerializeToJsonString();
            tBitmap.Dispose();
            return json;
        }
    }
}